/******************************************************************************

	COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2010.

	This file is part of Maxsi Engine.

	Maxsi Engine is free software: you can redistribute it and/or modify it
	under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or (at your
	option) any later version.

	Maxsi engine is distributed in the hope that it will be useful, but WITHOUT
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
	FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
	for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with Maxsi Engine. If not, see <http://www.gnu.org/licenses/>.

	MaxsiEngine.dll
	A general purpose C++ library for the Maxsi Technology Project.

	MaxsiDataContainer.cpp
	A very simple binary-safe text-based data container format. The data itself
	has no predefined meaning by this protocol and any meaning should be given
	by any subprotocols.

******************************************************************************/

#ifndef MaxsiDataContainer_H
#define MaxsiDataContainer_H

BeginMaxsiNamespace

CLASSLINK MaxsiDataContainer
{
public:
	MaxsiDataContainer();
	~MaxsiDataContainer();

private:
	bool	AppendToTemp(BYTE* Input, size_t Size);
	bool	ClearTemp();
	BYTE*	GetTemp();

public:
	List	TemporaryVariable;
	BYTE*	TemporaryVariableCache;
	size_t	TemporaryVariableCacheLen;
	MESTR*	VariableName;
	size_t	VariableLen;
	size_t	VariableLeft;
	BYTE*	ExternalCache;
	BYTE*	InternalCache;
	bool	ChangedExternalCache;
	BYTE	OldExternalCache;

public:
	bool	GetNextVariable(BYTE* Input, size_t Size, size_t &Read);
	bool	Done();

	MESTR*	Variable();
	BYTE*	VariableTemp();
	MESTR*	VariableKeep();

public:
	size_t	Step;

};

EndMaxsiNamespace

#endif
